#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int maxArea(int* height, int heightSize)
{
    int smax = 0;
    int i = 0;
    int j = 0;
    int L = 0;
    int H = 0;
    for (i = 0; i < heightSize; i++)
    {
        for (j = i + 1; j < heightSize; j++)
        {
            L = j - i;
            H = height[i] < height[j] ? height[i] : height[j];
            if (L * H > smax)
            {
                smax = L * H;
            }
        }
    }
    return smax;
}
int main()
{
    int height[9] = { 1,8,6,2,5,4,8,3,7 };
    printf("%d", maxArea(height, 9));
    return 0;
}